#include <iostream>

using namespace std;

template<typename T>
void slectionSort(T arr[], int n) { // 选择排序
    for (int i = 0; i < n; i++) {
        // i 到 n 区间的最小值
        int minIndex = i;
        for (int j = i + 1; j < n; j++) {
            if (arr[j] < arr[minIndex]) {
                minIndex = j;
            }
        }
        swap(arr[minIndex], arr[i]);
    }
}

int main() {
    std::cout << "Hello, World!" << std::endl;

    int a[5] = { 1, 3, 4, 2, 5};
    slectionSort(a, 5);
    for (int i = 0; i < 5; ++i) {
        std::cout << a[i] << std::endl;
    }

    float b[5] = { 1.3, 3.2, 4.2, 2.3, 5.1};
    slectionSort(b, 5);
    for (int i = 0; i < 5; ++i) {
        std::cout << b[i] << std::endl;
    }

    char c[5] = {};

    return 0;
}

